package com.xingyun.info_manager.service.impl;

import com.xingyun.info_manager.dao.ReportNetDao;
import com.xingyun.info_manager.entity.ParasBean;
import com.xingyun.info_manager.entity.PriAccountInfo;
import com.xingyun.info_manager.service.IReportNetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @Classname ReportNetServiceImpl
 * @Description TODO
 * @Date 2020/6/1 15:49
 * @Created by You
 */
@Service("reportNetService")
public class ReportNetServiceImpl implements IReportNetService {

    @Autowired
    private ReportNetDao reportNetDao;
    /**
     * 获取个人账户录入信息
     */
    @Override
    public List<PriAccountInfo> getPriAccountInfo(ParasBean parasBean) {
        return reportNetDao.getPriAccountInfo(parasBean);
    }

    @Override
    public int findCount(ParasBean parasBean) {
        return reportNetDao.findCount(parasBean);
    }

    /**
     * 获取今日录入量
     */
    @Override
    public PriAccountInfo getTodayInfo() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date todayTime = null;
        try {
            todayTime = sdf.parse(sdf.format(new Date()));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return reportNetDao.getTodayInfo(todayTime);
    }
}
